<%@ page import="java.util.*" pageEncoding="utf-8" %>
<%@include file="/commons/taglibs.jsp" %>
<!DOCTYPE html>
<html>
<fmt:bundle basename="res">
<head>
    <meta charset="utf-8">
    <title><fmt:message key='zhyyglhtxt'/></title>
    <jsp:include page="/WEB-INF/commons/commons-header.jsp" flush="true"/>
    <style>
        html {
            background: #fff;
        }

        .layui-form-label {
            width: 210px;
        }

    </style>
</head>

<body>

<div class="layui-tab layui-tab-brief" lay-filter="docDemoTabBrief">
    <ul class="layui-tab-title">
        <li class="layui-this"><fmt:message key='fyblsz'/></li>
        <li><fmt:message key='xgjl'/></li>
    </ul>
    <div class="layui-tab-content" style="height: 100%;">
        <div class="layui-tab-item layui-show">
            <div class="layui-container">
                <div class="layui-form" lay-filter="layuiadmin-app-form-list" id="layuiadmin-app-form-list" style="padding: 20px 30px 0 0;">
                    <form:form commandName="setting" action="${web_domain}/mall/setting/invoice/modify" method="post" class="layui-form">
                        <input type="hidden" name="_method" value="PUT">
                        <%--<div class="layui-form-item">--%>
                            <%--<label for="" class="layui-form-label">发票抬头</label>--%>
                            <%--<div class="layui-inline">--%>
                                <%--<input class="layui-input" lay-verify="required" name="invoiceTitle" value="${setting.invoiceTitle}"/>--%>
                            <%--</div>--%>
                        <%--</div>--%>

                        <%--<div class="layui-form-item">--%>
                            <%--<label for="" class="layui-form-label">税号</label>--%>
                            <%--<div class="layui-inline">--%>
                                <%--<input class="layui-input" lay-verify="required" name="invoiceNumber" value="${setting.invoiceNumber}"/>--%>
                            <%--</div>--%>
                        <%--</div>--%>

                        <%--<div class="layui-form-item">--%>
                            <%--<label for="" class="layui-form-label">开票地址</label>--%>
                            <%--<div class="layui-inline">--%>
                                <%--<input class="layui-input" lay-verify="required" name="invoiceAddress" value="${setting.invoiceAddress}"/>--%>
                            <%--</div>--%>
                        <%--</div>--%>

                        <div class="layui-form-item">
                            <label for="" class="layui-form-label"><fmt:message key='sjtxsxfl'/></label>
                            <div class="layui-inline">
                                <input class="layui-input" lay-verify="required|number|lessZero" name="invoiceScale" <c:if test="${setting.invoiceScale > 0}">value="${setting.invoiceScale}"</c:if>/>
                            </div>
                            <div class="layui-inline"><fmt:message key='rsz50%,qtx0.5'/></div>
                        </div>

                        <div class="layui-form-item">
                            <label for="" class="layui-form-label"><fmt:message key='gystxsxfl'/></label>
                            <div class="layui-inline">
                                <input class="layui-input" lay-verify="required|number|lessZero" name="supplierInvoiceScale" <c:if test="${setting.supplierInvoiceScale > 0}">value="${setting.supplierInvoiceScale}"</c:if>/>
                            </div>
                            <div class="layui-inline"><fmt:message key='rsz50%,qtx0.5'/></div>
                        </div>

                        <div class="layui-form-item">
                            <label for="" class="layui-form-label"></label>
                            <div class="layui-input-inline">
                                <input type="button" value="<fmt:message key='qd'/>" lay-submit lay-filter="submit" class="layui-btn">
                            </div>
                        </div>

                    </form:form>
                </div>
            </div>
        </div>

        <div class="layui-tab-item" style="height: 800px;">
            <iframe src="${web_domain}/mall/setting/invoice/record" style="width:100%;height: 100%;" frameborder="0"></iframe>
        </div>


    </div>
</div>

<script>
    layui.use(['form'], function () {
        var form = layui.form;

        form.verify({
            lessZero: function (value, item) {
                if (value < 0) {
                    return "<fmt:message key='bnxy0'/>";
                }
            }
        });

        form.on('submit(submit)', function (data) {

            layer.load(2);
            $("#setting").ajaxSubmit({
                success: function (res) {
                    layer.closeAll();
                    if (res.status) {
                        layer.alert("<fmt:message key='xgcg'/>", function () {
                            location.reload();
                        });
                    } else {
                        layer.alert(res.msg);
                    }
                }
            });
            return false;
        });
    });
</script>
</body>
</fmt:bundle>
</html>